<?php

use think\migration\Migrator;
use app\model\Agent;

class AlterAgentIsRelation extends Migrator
{
    public function up()
    {
        $agent = Agent::query()
            ->where('mobile',15311187616)
            ->where('is_relation',Agent::IS_RELATION_NO)
            ->find();
        if ($agent) {
            $agent->is_relation = Agent::IS_RELATION_YES;
            $agent->save();
        }

    }

    public function down()
    {
        $agent = Agent::query()
            ->where('mobile',15311187616)
            ->where('is_relation',Agent::IS_RELATION_YES)
            ->find();
        if ($agent) {
            $agent->is_relation = Agent::IS_RELATION_NO;
            $agent->save();
        }
    }
}
